home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 34
/
034.d81
/
calendar maker
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
4KB
|
136 lines
100 print"[147]"chr$(142);:poke53280,.:poke53281,.
110 dim c$(42),d$(31),m$(12),n(12),dn$(7),g$(10)
120 print" [155]loadstar presents:"
130 print spc(13);"[159]calendar maker"
140 print"[150] by mark haugan"
150 print" (c) copyright 1987"
160 for i=1 to 31:read d$(i):next i
170 for i=1 to 12:read m$(i):next i
180 for i=1 to 12:read n(i):next i
190 for i=1 to 7:read dn$(i):next i
200 print" for what month and year do you wish to"
210 print"print the calendar?"
220 print"[154]enter month, q [154]to quit: [157][157][157][157][157][157][157][157][157][157]";:mm=9:gosub1090:m$=a$
230 ifm$=""thenprint"[145]";:goto220
240 ifm$="q"thengosub1190:goto220
250 m=val(m$):if m>0 and m<13 then 290
260 fori=1to12:if(m$=left$(m$(i),len(m$)))thenm=i:goto280
270 next:print:gosub1000:gosub1020:goto220
280 ifi=13thenprint"[145]";:goto220
290 print"[154] enter year, q [154]to quit: [157][157][157][157][157][157][157][157]";:mm=4:gosub1090:y=val(a$)
300 ifa$="q"thengosub1190:goto290
310 if(y<0)or(a$="")thenprint"[145]";:goto290
320 ify<100theny=y+1900
330 rem printer check
340 :
350 print"[159] be sure your printer is turned on!"
360 print"[159] press space [159]to continue, q [159]to quit."
370 geta$:ifa$<>" "anda$<>"q"anda$<>"[209]"then 370
380 ifa$="q"ora$="[209]"thengosub1190:goto360
390 open15,4,15:close15:ifst<>.thengosub1050:goto370
400 ifval(m$)>0thenm$=m$(val(m$))
402 p$=m$+","+str$(y):ta=20-(len(p$)/2)
405 print"[129] printing calendar for ":printtab(ta)p$:print
410 gosub1080
420 j=367*y-int(7*(y+int((m+9)/12))/4)+int(275*m/9)+1721031
430 k=0:if m<=2 then k=-1
440 j=j-int(3*(int((y+k)/100)+1)/4)
450 k=n(m):if m<>2 then 500
460 w=int(y-100*int(y/100)):x=int(y-4*int(y/4)):z=int(y-400*int(y/400))
470 if x<>0 then 500
480 if w=0 and z<>0 then 500
490 k=29
500 x=j-7*int(j/7)
510 geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
520 h$="-----------"
530 for i=0 to 42:c$(i)="[165] ":next i
540 geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
550 for i=1 to k:c$(i+x)=d$(i)+" ":next i
560 rem open printer channel
570 open4,4
580 rem print title
590 geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
600 if i+x<=36 then f5=1:for i=1 to 5:print#4:next i
610 t$=m$(m)+str$(y):c=20-len(t$)/2:print#4,chr$(14);
620 for i=1 to c:print#4," ";:next i
630 geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
640 print#4,t$:print#4,chr$(15):print#4
650 rem print day names
660 for i=1 to 7:geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
665 print#4,dn$(i);:next i:print#4
670 rem print main calendar
680 for i=1 to 5:j=7*i
690 geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
700 for l=1 to 7:geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
705 print#4,h$;:next l:print#4
710 geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
720 for l=6 to 0 step -1:geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
725 print#4,c$(j-l);:next l:print#4,"[165]"
730 geta$:ifa$="q"thengosub1300:gosub1080
740 for l=1 to 7:for n=1 to 7:geta$:ifa$="q"thengosub1300:gosub1080
745 print#4,c$(0);:next n:print#4,"[165]":next l
750 geta$:ifa$="q"ora$="[209]"thengosub1300:gosub1080
760 next i
770 if f5=1 then 820
780 j=42
790 for k=1 to 7:print#4,h$;:next k:print#4
800 for k=6 to 0 step -1:print#4,c$(j-k);:next k:print#4,"[165]"
810 for k=1 to 7:for l=1 to 7:print#4,c$(0);:next l:print#4,"[165]":next k
820 for k=1 to 7:print#4,h$;:next k:print#4
830 rem close printer channel and quit
840 print#4:close4
842 print"[145][145] would you like to print another copy"
843 print" of this year and month?"
844 poke198,0:wait198,1:geta$:ifa$<>"y"anda$<>"[217]"anda$<>"n"anda$<>"[206]"then844
845 ifa$="y"ora$="[217]"then350
846 :
850 print"[153][145][145] would you like to print another? "
860 print"[145] "
870 geta$:ifa$<>"y"anda$<>"n"anda$<>"[217]"anda$<>"[206]"then870
880 ifa$="y"ora$="[217]"thenrun
890 ifa$="n"ora$="[206]"then1230
900 rem data
910 data "[165] 1","[165] 2","[165] 3","[165] 4","[165] 5","[165] 6","[165] 7","[165] 8","[165] 9","[165]10"
920 data "[165]11","[165]12","[165]13","[165]14","[165]15","[165]16","[165]17","[165]18","[165]19","[165]20"
930 data "[165]21","[165]22","[165]23","[165]24","[165]25","[165]26","[165]27","[165]28","[165]29","[165]30","[165]31"
940 data "january","february","march","april"
950 data "may","june","july","august","september"
960 data "october","november","december"
970 data 31,28,31,30,31,30,31,31,30,31,30,31
980 data " sunday "," monday "," tuesday "," wednesday "
990 data " thursday "," friday "," saturday "
1000 ok=.:fora=1to12:if(m$=m$(a))or(m$=left$(m$(a),3))thenok=-1:return
1010 next:return
1020 print" error: invalid month"
1030 fora=1to2000:next:print"[145] [145][145][145]"
1040 return
1050 print" error: your printer is not online!"
1060 fora=1to2000:next
1070 print"[145] [145][145][145]":return
1080 print" [154]press and hold q [154]to quit. ":return
1090 print"[164]";:fora=1tomm+1:g$(a)=""
1100 geta$:ifa$=""then1100
1110 ifa$=chr$(13)then1170
1120 if(a$=chr$(20))and(a>1)thena=a-1:print"[157][157] [157][157][164]";:g$(a)="":goto1100
1125 if(a=mm+1)then1100
1130 if(a$>=" ")and(a$<="_")then1160
1140 if(a$>="[193]")and(a$<="[218]")thena$=chr$(asc(a$)-128):goto1160
1150 goto1100
1160 print"[157] [157]"a$;:poke212,.:print"[164]";:g$(a)=a$:next
1170 print"[157] ":a$="":forb=1toa-1:a$=a$+g$(b):next
1180 return
1190 print"[145][154] are you sure you want to quit? (y[154]/n[154])"
1200 geta$:ifa$<>"y"anda$<>"n"anda$<>"[217]"anda$<>"[206]"then1200
1210 ifa$="y"ora$="[217]"then1230
1220 print"[145] ":print"[145]";:return
1230 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
1240 print"[147]";:ifer<>63thenend
1250 load"hello connect",8
1260 :
1300 rem other quit
1310 print"[145][154] are you sure you want to quit? (y[154]/n[154])"
1320 geta$:ifa$<>"y"anda$<>"n"anda$<>"[217]"anda$<>"[206]"then1320
1330 ifa$="y"ora$="[217]"thenrun
1340 print"[145]";:return
1350 :